//
//  PhotoCollectionHeadView.m
//  WOFishingBoat
//
//  Created by 郑逸凯 on 2019/1/8.
//  Copyright © 2019年 郑逸凯. All rights reserved.
//

#import "PhotoCollectionHeadView.h"
#import <IQKeyboardManager/IQKeyboardManager.h>

@implementation PhotoCollectionHeadView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.timeLabel];
        [self addSubview:self.selectButton];
    }
    return self;
}


- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat width = self.frame.size.width;
    CGFloat height = self.frame.size.height;
    self.timeLabel.frame = CGRectMake(0, 0, width - height, height);
    self.selectButton.frame = CGRectMake(self.frame.size.width - height , 0, height, height);
}

- (UIButton *)selectButton {
    if (!_selectButton) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setTitle:@"选择" forState:UIControlStateNormal];
        [button setTitle:@"取消" forState:UIControlStateSelected];
        button.titleLabel.font = [UIFont systemFontOfSize:14];
        [button setTitleColor:RGB16(0x2988fc) forState:UIControlStateNormal];
       
        _selectButton = button;
    }
    return _selectButton;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 36)];
        label.textColor = RGB16(0x333333);
        label.font = [UIFont systemFontOfSize:18];
        _timeLabel = label;
    }
    return _timeLabel;
}



@end
